const express = require('express');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const path = require('path');
const fs = require('fs');

const userRouter = require('./router/user/userRouter');

var app = express();

app.listen(8088, (e)=>{
    if(!e){
        console.log('app is running...')
    }
})

// 打包后访问静态资源
app.use(express.static(path.resolve(__dirname, '../dist')));
app.get('*', function(req, res) {
    const html = fs.readFileSync(path.resolve(__dirname, '../dist/index.html'), 'utf-8')
    res.send(html);
})

// app.use('/login', userRouter.router)